﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RemoteLinqBase.ServerBase
{
	public delegate object GetResultLinqDelegate(string linq);

	public class GenericWrapper<TParent>
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="GenericWrapper&lt;TParent&gt;"/> class.
		/// </summary>
		private GenericWrapper()
		{
		}

		public GetResultLinqDelegate GetResultLinq { get; private set; }

		/// <summary>
		/// Gets the wrapper.
		/// </summary>
		/// <typeparam name="TItem">The type of the item.</typeparam>
		/// <param name="source">The source.</param>
		/// <returns>Wrapper around source IRESTRepository.</returns>
		public static GenericWrapper<TParent> GetWrapper<TItem>(GenericCollection<TItem> source)
			where TItem : class, TParent
		{
			GenericWrapper<TParent> wrapper = new GenericWrapper<TParent>();
			wrapper.GetResultLinq = source.GetResultLinq;
			return wrapper;
		}
	}
}
